<?php
/**
 * dao episodedao
 * @package app-drama_lib_dao
 */
load_lib('/dao/basedao');
/**
 * dao episodedao
 * @author pandajingjing
 * @package app-drama_lib_dao
 */
class dao_episodedao extends dao_basedao{

    /**
	 * 获取语言列表
	 * @param $p_arrParam
	 * @return array
	 */
    static function getLangList($p_arrParam){
        $strSQL='';
        $arrParam=array();
        if(isset($strSQL[0])){
            $strSQL=substr($strSQL,0,4);
        }
        $objORM=parent::getORM('drama_dt_lang','drama_db');
        if(isset($p_arrParam['SORT'])){
            $objORM->setOrder($p_arrParam['SORT']);
        }
        return $objORM->getList($strSQL,$arrParam);
    }

    /**
     * 添加剧集
     * @param array $p_arrParam
     * @return int/false
     */
    static function addEp($p_arrParam){
        $p_arrParam['CREATETIME']=parent::getTime();
        return parent::addData('drama_episode',$p_arrParam,'drama_db');
    }
    
    /**
     * 编辑剧集
     * @param array $p_arrParam
     * @return int/false
     */
    static function saveEp($p_arrParam){
        $p_arrParam['UPDATETIME']=parent::getTime();
        return parent::updData('drama_episode',$p_arrParam,'drama_db');
    }

    /**
     * 获取剧集列表
     * @param array $p_arrParam
     * @return array
     */
    static function getEpList($p_arrParam){
        $strSQL='';
        $arrParam=array();
        if(isset($p_arrParam['SERIESID'])){
            $strSQL.=' and SERIESID=:SERIESID';
            $arrParam['SERIESID']=$p_arrParam['SERIESID'];
        }
        if(isset($p_arrParam['DSTATUS'])){
            $strSQL.=' and DSTATUS=:DSTATUS';
            $arrParam['DSTATUS']=$p_arrParam['DSTATUS'];
        }
        if(isset($strSQL[0])){
            $strSQL=substr($strSQL,4);
        }
        $objORM=parent::getORM('drama_episode','drama_db');
        if(isset($p_arrParam['SORT'])){
            $objORM->setOrder($p_arrParam['SORT']);
        }
        return $objORM->getList($strSQL,$arrParam);
    }
    
    /**
     * 获取多个剧集
     * @param string $p_strFileKeys
     * @return array
     */
    static function getEps($p_strFileKeys){
        $objORM=parent::getORM('drama_episode','drama_db');
        return $objORM->getListByPKIDs($p_strFileKeys);
    }
}